package 
{
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	import flash.utils.Dictionary;
	import flash.utils.getTimer;
	import flash.net.*;
	import mx.rpc.soap.*;
	import mx.core.*;
	import mx.rpc.events.*;
	
	import actions.GetUser;
	
	/**
	 * ...
	 * @author Diego Furque
	 */
	public class Main extends Sprite 
	{
		private var _mc :Sprite;
		private var _args :GetUser;
		private var _wscon :WSConnection;
		
		public function Main()	:void 
		{
			if ( stage ) init();
			else addEventListener( Event.ADDED_TO_STAGE, init );
		}
		
		private function init( e :Event = null ) :void 
		{
			removeEventListener( Event.ADDED_TO_STAGE, init );
			addEventListener( Event.ENTER_FRAME, loop );
			
			this._mc = new SquareAsset();
			this._mc.x = 0;
			this._mc.y = -5;
			this.addChild( this._mc );
			
			this._wscon = new WSConnection();
			this._wscon.wsdl = "http://df.bunkimunki.com:81/api/user?wsdl";
			this._wscon.action = "getUser";
			this._args = new GetUser();
			this._args.userId = 1;
			this._args.withAlias = true;
			this._wscon.args = this._args;
			this._wscon.resultFormat = "e4x";
			this._wscon.conn();
		}
		
		private function loop( e :Event ) :void 
		{
			( this._mc.getChildByName( "output_txt" ) as TextField ).text = String( this._wscon.result );
		}
	}
}